import React, { PureComponent } from 'react'

import { Navigate } from "react-router-dom";

export default class User extends PureComponent {
  constructor() {
    super()

    this.state = {
      isLogin: false
    }
  }

  render() {
    return this.state.isLogin ? (
      <div>
        <h2>User</h2>
        <p>用户的一些信息</p>
      </div>
    ) : <Navigate to="/login" replace={true}/>
    // replace: true  可返回
    // v5 <Redirect to="login" />
  }
}
